﻿/*
    Copyright (C) 2012  Milton da Silva Junior - admin.jr.dotnet@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Loja.DataDTO;
using Loja.Business;

namespace Loja.Controllers
{
    public class VendaController : Controller
    {
        private void GetTipoPagamento()
        {
            List<SelectListItem> items = new List<SelectListItem>();
            items.Add(new SelectListItem { Text = "Dinheiro", Value = "1" });

            ViewData["TipoPagamento"] = items;
        }

        private void GetComprador()
        {
            List<SelectListItem> items = new List<SelectListItem>();
            items.Add(new SelectListItem { Text = "Milton da Silva Junior", Value = "1" });

            ViewData["Comprador"] = items;
        }
        //
        // GET: /Venda/

        public ActionResult Index()
        {
            GetComprador();
            GetTipoPagamento();

            return View();
        }

        public ActionResult CriarVenda(int idPedido)
        {
            VendaBLL vendaBll = new VendaBLL();
            PedidoBLL pedidoBll = new PedidoBLL(false);

            var pedido = pedidoBll.GetPedidoDTO(idPedido);
            var pagamento = vendaBll.GetVendaDTO(pedido);

            return View("Index", pagamento);
        }
    }
}
